package com.wintrue.ffxs.ui.home.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;
import com.wintrue.ffxs.R;
import com.wintrue.ffxs.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created by wenjie on 2017/8/23.
 */

public class XlvAdapter extends BaseAdapter{
    Context context;
    List<Map<String,Object>> list;

    public XlvAdapter(ArrayList<Map<String, Object>> list, Context context) {
      this.context=context;
       this.list=list;
    }


    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        MyHolder holder=new MyHolder();
        if(convertView==null){
            convertView=View.inflate(context, R.layout.home_xlistview_footer,null);
            holder.img1= (ImageView) convertView.findViewById(R.id.img1);
            holder.img2= (ImageView) convertView.findViewById(R.id.img2);
            holder.tv1= (TextView) convertView.findViewById(R.id.tv1);
            holder.tv3= (TextView) convertView.findViewById(R.id.tv2);
            convertView.setTag(holder);
        }else {
            holder = (MyHolder) convertView.getTag();
        }
//        Picasso.with(context).load((String) list.get(position).get("picPath")).into(holder.img);
//        holder.tv1.setText("￥" + list.get(position).get("textKey"));
        return convertView;
    }

    class MyHolder{
        ImageView img1,img2;
        TextView tv1,tv3;
    }

}
